<template>
  <yy-paging v-model="dataList" @query="queryList" ref="paging" :auto="true" @scroll="scroll" :refresher-enabled="true">
    <template #top>
      <u-navbar
        back-text=""
        title="系统消息"
        :background="{ backgroundColor: !isScroll ? '#F4F6F8' : 'transparent' }"
        :border-bottom="false"
        :custom-style="{ transition: 'background-color 0.3s ease-in-out' }"
      >
      </u-navbar>
    </template>
    <view class="flex flex-col gap-2 p-4">
      <view v-for="(i, k) in 10" :key="k" class="bg-[#FFFFFF] rounded-[12px] p-4 flex flex-col gap-3">
        <view class="flex justify-between">
          <view class="font-bold text-[15px] text-[#161A24]"> 系统消息 </view>
          <view class="text-[12px] text-[#8E9299]"> 2025-03-03 </view>
        </view>
        <view class="text-[14px] text-[#161A24]"> 👏欢迎您加入钓点达人～ 在这里，您将开启一场探索垂钓的乐趣，共享渔乐无穷的精彩旅程 </view>
      </view>
    </view>
  </yy-paging>
</template>

<script>
  export default {
    data() {
      return {
        isScroll: false,
        dataList: [],
        automatic: false
      }
    },
    onLoad() {},
    methods: {
      scroll(e) {
        this.isScroll = e.detail.scrollTop > 0
      },

      async queryList(page, limit) {
        this.$refs.paging.complete([11])

        let res = await api.messageList({ page, limit, id: 1 })
        if (!res.code) return
        this.$refs.paging.complete(res.data)
      }
    }
  }
</script>

<style lang="scss" scoped></style>
